{% extends "base.html" %}
{% load static %}

{% block title %} Register {% endblock %}
{% block pagetitle %} Registration {% endblock %}

{% block nav %}
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
    <a class="navbar-brand" href="{% url 'yaksh:index' %}">
        <img src="{% static 'yaksh/images/yaksh_banner.png' %}" alt="YAKSH">
    </a>
</nav>
{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row justify-content-center form-group">
        <div class="col-md-4 col-md-offset-4">
            <form action="" method="post">
                <fieldset>
                    {% csrf_token %}
                    <h4> Please fill in the following details:</h4>
                    <center>
                        {% if form.errors %}
                            {% for field in form %}
                                {% for error in field.errors %}
                                    <div class="alert alert-dismissible alert-danger">
                                        <button type="button" class="close" data-dismiss="alert">
                                            <i class="fa fa-close"></i>
                                        </button>
                                        <strong>{{ error|escape }}</strong>
                                    </div>
                                {% endfor %}
                            {% endfor %}
                            {% for error in form.non_field_errors %}
                                <div class="alert alert-dismissible alert-danger">
                                    <button type="button" class="close" data-dismiss="alert">
                                        <i class="fa fa-close"></i>
                                    </button>
                                    <strong>{{ error|escape }}</strong>
                                </div>
                            {% endfor %}
                        {% endif %}
                        {% for field in form %}
                            <td>{{ field }} <small>{{ field.help_text }}</small></td>
                            <br>
                        {% endfor %}
                        <br>
                        <br>
                    </center>
                    <center>
                        <button class="btn btn-success btn-lg" type="submit">
                            Register
                        </button>
                        <a href="{% url 'yaksh:index' %}" class="btn btn-primary btn-lg">
                            Cancel
                        </a>
                    </center>
                </fieldset>
            </form>
        </div>
    </div>
</div>
{% endblock content %}
